package com.mipo.designpattern.factorypattern.simplefactory.sample.LightFactory;

/**
 * simple factory pattern,also called as static factory method pattern
 * 
 * @author kitty
 */
public class Factory {

	public static Light getInstance(String lightType) {
		Light light = null;
		// 如果没传type,也可以写到配置文件,然后从配置文件获取type；其实也可以使用反射来动态生成
		if ("BulbLight".equals(lightType)) {
			light = new BulbLight();
		}
		if ("TubeLight".equals(lightType)) {
			light = new TubeLight();
		}
		return light;
	}

}